-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{ACS} az openshift show/list: Refactoring to reduce the probability of AttributeError #13358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem like we ever had name and os_type attributes in the public API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this code been here since the beginning of times too. Not sure what broke the command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @m1kola , is this because the different API version? Are you sure we can remove these code safely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arrownj I'm currently not sure why it's happening. It was working fine on Azure CLI 2.3.1 (maybe on newer versions too) and az openshift show and az openshift list are broken on 2.5.1 and dev branch.
As far as I see, we did not change anything in the API and we never had name and os_type fields in the master pool profile API on the server (I checked all the supported versions in our codebase).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the break:
Azure/azure-sdk-for-python@3f6238b#diff-66c3074fc0745e8946eba5783a5f8f32R21
The client library we were using was stale having been generated on an ancient pre-GA API and ^ brings us up to date.
|
@julienstroheker could you also please take a look? |
|
add to S169 |
jim-minter
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm +1 on this change. Thanks @m1kola !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the break:
Azure/azure-sdk-for-python@3f6238b#diff-66c3074fc0745e8946eba5783a5f8f32R21
The client library we were using was stale having been generated on an ancient pre-GA API and ^ brings us up to date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if getattr(managed_cluster, attr, None) is None: | |
| if hasattr(managed_cluster, attr) and getattr(managed_cluster, attr) is None: |
arguably ^ is better, but it doesn't really matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If remember Python correctly getattr(managed_cluster, attr) still needs to be getattr(managed_cluster, attr, None). Otherwise there will be an exception in case when there is no attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it makes sense. I'll update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh. I see... hasattr :) Tired brain.
It was failing with a Python Traceback
76b3ae4 to
94afb75
Compare
|
It looks like it is a duplicated of #13315 |
|
The changes in the original PR were a duplicate of #13315 which got merged recently. I rebased the PR and I updated it so we hopefully reduce the probability of Please take another look. |
|
LGTM. |
Description
The changes in the original PR were a duplicate of #13315 which got merged recently. I rebased the PR and I updated it so we hopefully reduce the probability of
AttributeErrorin the similar cases.This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.